﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_BBS_DeleteBoard]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_BBS_DeleteBoard];
GO
CREATE PROCEDURE [dbo].[sproc_BBS_DeleteBoard]
    @board_id int
/*

==========================================================
功能:    删除板块
参数:
    @board_id     :    板块ID
==========================================================

*/
AS
SET NOCOUNT ON
--删除板块回复
DELETE FROM uds_bbs_replay
    WHERE item_id IN
    (SELECT item_id FROM uds_bbs_forumitem
    WHERE board_id = @board_id)
--删除板块帖子
DELETE FROM uds_bbs_forumitem
    WHERE board_id = @board_id
--删除板块
DELETE FROM uds_bbs_board 
    WHERE board_id = @board_id
--删除该版斑竹
DELETE FROM uds_bbs_boardmaster
    WHERE board_id = @board_id
--删除该版成员
DELETE FROM uds_bbs_boardmember
    WHERE board_id = @board_id